<template>
	<view class="u-page">
		<view v-for="(item, index) in list" :key="index">
			<u-cell customStyle="background:#fff;" :title="item.gird_title" :isLink="true" @click="editgird(item)">
				<view slot="label">
					<text class="tag-info" v-for="(driver,x) in item.drivers" :key="x">{{driver.realname}}</text>
				</view>
			</u-cell>
		</view>
		<u-empty v-if="list.length==0" text="没有网格!" mode="search" marginTop="50"></u-empty>
		<view class="plusbtn" @click="$navigateTo" data-url="admin/adddriver">
			<u-icon name="plus" size="24" color="#fff"></u-icon>
		</view>
	</view>
</template>

<script>
	import {methods} from '@/utils/methods.js';
	export default {
		data() {
			return {
				list:[]
			}
		},
		onPullDownRefresh() {
			uni.stopPullDownRefresh();
		},
		onShow() {
			this.$get('admin/admin/gird').then(res=>{
				this.list=res;
			});
		},
		methods: {
			...methods,
			editgird:function(e){
				this.$navigateTo('admin/driver?id='+e.id)
			},
		}
	} 
</script>

<style lang="scss">
	.plusbtn{
		position: fixed;
		bottom: 20rpx;
		right: 20rpx;
		background-color: #3f9ad7;
		border-radius: 50%;
		padding: 8rpx;
		z-index: 999;
	}
</style>